window.onload=function(){
	var log =document.getElementById("order");
		log.onclick=function(){
			
			var tel         = $("#tel").val();
			var password 	= $("#passwordBefore").val();  
    		var passwordNew = $('#passwordNew').val();
    		var passwordNew2= $('#passwordNew2').val();
		
			if(passwordNew.length<6) alert("密码过于短，请重新输入");
    	    	else{
    	    		if(passwordNew!==passwordNew2) alert("两次密码不同，请重新输入");
							else{	
								
						var postData = {
							"submit":"修改密码",
							"tel": tel,
							"old_password": password,
							"new_password": passwordNew,
							"new_password_conf":passwordNew2
							}	
							console.log(postData);
							$.post('http://118.89.25.120/alter_password.php', postData, function (data) {
									//console.log(data);
									var obj  = JSON.parse(data.trim());
									//console.log(obj.success);
									if(obj.success==1)  {
										alert("修改成功");
										//window.location="homeback.html";
									} else if (obj.success==0) {
										alert("修改失败");
									} 
							});
							
			/*$.ajax({
				type:"post",
				url:"http://118.89.25.120/alter_password.php",
				dataType:"json",
				data:{submit:"确定",password:password,passwordNew:passwordNew,passwordNew2:passwordNew2},
				success:function(e){
			 		window.location.href="prompt.html";
				},
				error:function(e){
					alert(" ");
				}
			});	*/
    			}
			}
		}
	}
